<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>百顺通云-后台用户管理</title>
        <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
        <!-- 公用CSS文件引入 -->
        <jsp:include page="../../admin/commonCSS.jsp"></jsp:include>
        <!-- 树节点插件 -->
        <link href="/cdn/zTree_v3/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css">    
        <!-- 局部css -->
        <link href="/css/admin/productManager.css" rel="stylesheet" type="text/css"/>
 
    </head>
    <body class="skin-blue">
        
		<!-- 公用头部 -->
        <jsp:include page="../../admin/commonHeader.jsp"></jsp:include>
        
        <div class="wrapper row-offcanvas row-offcanvas-left">
            <!-- 公用导航 -->
            <jsp:include page="../../admin/commonMenu.jsp"></jsp:include>

            <!-- Right side column. Contains the navbar and content of the page -->
            <aside class="right-side">
                <!-- Content Header (Page header) -->
                <section class="content-header">
                    <h1>首页推荐设置<small>首页推荐设置列表</small></h1>
                    <ol class="breadcrumb">
                        <li><a href="#"><i class="fa fa-dashboard"></i>首页</a></li>
                        <li class="active">首页推荐设置</li>
                    </ol>
                </section>

                <!-- Main content -->
                <section class="content" id="indexrecommend">
			  		<!-- 操作 -->
			  		<div id="sec1">
	                    <div class="operator">
						  	<button type="button" class="btn btn-default addnew">新增</button>
						</div>
						<div class="bstable">
					  		<table class="table table-bordered" id="indextable">
						      <thead>
						        <tr>
						          <th>序号</th>
						          <th>模块名称</th>
						          <th class="filterctyth">
						          	<span class="filter filtercty">显示类别</span>
						          	<i class="fa fa-fw fa-sort-desc"></i>
						          </th>
						          <th>
						          	<span class="filter filtername">排列顺序</span>
						          	<i class="fa fa-fw fa-sort-desc"></i>
						          </th>
						          <th>
						          	<span class="filter filtertime">创建时间</span>
						          	<i class="fa fa-fw fa-sort-desc"></i>
						          </th>
						          <th>
						          	<span>操作</span>
						          </th>
						        </tr>
						      </thead>
						      <tbody>
							      <c:if test="${indexModuleList.size() == 0}">
									<tr><td colspan="6">暂无数据，请添加过商品后再查看！</td></tr>
								  </c:if>
								  <c:if test="${indexModuleList.size() != 0}">
									<c:forEach items="${indexModuleList}" var="indexModule" varStatus="status">
										<tr>
								          <td>${ status.index + 1}</td>
								          <td>${indexModule.moduleName}</td>
								          <td>${indexModule.typeName}</td>
								          <td>${indexModule.moduleNum}</td>
								          <td><fmt:formatDate value="${indexModule.createTime}" pattern="yyyy-MM-dd"/></td>
								          <td class="opration" data-id="${indexModule.moduleId}">
								          	<a href="javascript:void(0);" class="indexmodelook">查看</a>
								          	<a href="javascript:void(0);" class="indexmodeedit">编辑</a>
								          	<a href="javascript:void(0);" class="indexmodedelete">删除</a>
								          	<c:if test="${indexModule.isShow == 0}">
								          		<a href="javascript:void(0);" class="indexmodestop">隐藏</a>
								          	</c:if>
								          	<c:if test="${indexModule.isShow == 1}">
								          		<a href="javascript:void(0);" class="indexmodestart">显示</a>
								          	</c:if>
								          	
								          </td>
								        </tr>
									</c:forEach>
								  </c:if>
						      </tbody>
						    </table>
				  		</div>
			  		</div>
			  		<div id="sec2" style="display:none;">
			  			<form class="form-horizontal" role="form">
							  <div class="form-group">
							    <label for="inputEmail3" class="col-sm-3 control-label">模块名称：</label>
							    <div class="col-sm-8">
							      <input type="text" class="form-control input-sm" id="moduleName" placeholder="模块名称">
							    </div>
							  </div>
							 <div class="form-group" id="showcategory">
							    <label for="inputPassword3" class="col-sm-3 control-label">显示类别：</label>
							    <div class="col-sm-9">
							        <div class="selTreeCombine">
										<input type="text" class="form-control input-sm" id="moduleCategory" placeholder="类别">
										<div class="seltreebox" style="display: none;">
											<ul id="categoryTree" class="categoryTree ztree"></ul>
										</div>
									</div>
							    </div>
							  </div>
							  <div class="form-group">
							    <label class="col-sm-3 control-label">排列顺序：</label>
							    <div class="col-sm-8">
									<input type="text" class="form-control input-sm" id="moduleNum" placeholder="请输入1-10的正整数">
							    </div>
							  </div>
							  <div class="form-group">
							    <div class="col-sm-offset-4 col-sm-10" id="addfeemode">
							      <button type="button" class="btn btn-default confirm">确定</button>
							      <button type="button" class="btn btn-default cancel">取消</button>
							    </div>
							  </div>
							</form>
			  		</div>
			  		
                </section>
            </aside><!-- /.right-side -->
        </div><!-- ./wrapper -->
		<script type="text/javascript">
			var currentMenu = 'productManager';
		</script>
		<!-- 公用js文件引入 -->
        <jsp:include page="../../admin/commonJs.jsp"></jsp:include>
        <!-- 树节点插件 -->
		<script type="text/javascript" src="/cdn/zTree_v3/js/jquery.ztree.core-3.5.js"></script>
		<!-- 局部js文件 -->
		<script src="/js/admin/productManager/indexGroomManager.js"></script>
		
		<script>
		var zNodes = [{id:-1,pId:0,name:"全部",open:true}];
		$.ajax({
			type:"POST",
			url:"/sysAdmin/goodsTypeAdmin/selectGoodsType",
			async:false,
			dataType:"json",
			success:function(data,response){
				var goodsTypeList = data.goodsTypeList;
				
				for(var i=0;i<goodsTypeList.length;i++){
					var gt = goodsTypeList[i];
					var id = gt.typeId;
					var pId = gt.parentId;
					var name = gt.typeName;
					var open = false;
					if(pId == -1) open = true;
					var znode = {
						id : id,
						pId : pId,
						name : name,
						open : open
					};
					zNodes.push(znode);
					/* 初始化分类树 */
					BSTMG.indexmanager.initCategoryTree();
				}
			}
		});
		</script>
    </body>
</html>